var baseUrl = 'http://47.108.197.28';
function http(url){
    return new Promise((resolve,reject)=>{
        wx.request({
            url:baseUrl+url,
            header: {'content-type':'application/json'},
            method: 'GET',
            dataType: 'json',
            responseType: 'text',
            success: (res)=>{
                resolve(res)
            },
            fail: (err)=>{
                reject(err)
            }
        });
    })
}
function getTop250Http(){
    return http(":4000/api/movie/top250")
}
function getMovieDetailHttp(id){
    return http(`:4000/api/movieDetail?id=${id}`)
}
function getMusicHttp(offset){
    return  http(`:3000/top/playlist?offset=${offset}&limit=20`)

}

function getHktkHttp(limit){
     return http(`:3000/dj/program/toplist/?limit=${limit}`)
     
}
function getTOPHttp(offset){
    return http(`:3000/top/album?offset=${offset}&limit=20`)
}

module.exports = {
    getTop250Http,
    getMovieDetailHttp,
    getMusicHttp,
    getHktkHttp,
    getTOPHttp
}